//背景特效
function starting(stars, className, n) {
    // js随机生成流星
    for (var j = 0; j < n; j++) {
      var newStar = document.createElement("div")
      newStar.className = "star";
      newStar.style.top = randomDistance(800, 0) + 'px';
      newStar.style.left = randomDistance(2100, 0) + 'px';
      stars.appendChild(newStar);
    }
    // 封装随机数方法
    function randomDistance(max, min) {
      var distance = Math.floor(Math.random() * (max - min + 1) + min);
      return distance;
    }
    var star = document.getElementsByClassName(className);
    function throttle(fn, waitTime) {
      var lastTime = null
      return function () {
        var startTime = + new Date()
        if (startTime - lastTime > waitTime || !lastTime) {
          fn()
          lastTime = startTime
        }
      }
    }
    // 给流星添加动画延时
    for (var i = 0, len = star.length; i < len; i++) {
      star[i].style.animationDelay = i % 6 == 0 ? '.1s' : i * 1 + 's';
    }
};